home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
dsglue.h.z
/
dsglue.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
6KB
|
170 lines
#ifndef __SYS_DSGLUE_H__
#define __SYS_DSGLUE_H__
/**************************************************************************
* *
* Copyright (C) 1990, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*
* dsglue.h - devscsi glue layer
*
* Copyright 1988, 1989, by
* Gene Dronek (Vulcan Laboratory) and
* Rich Morin (Canta Forda Computer Laboratory).
* All Rights Reserved.
* Ported to SGI by Dave Olson 3/89
*
* This file is normally used only by the kernel. All system-
* dependent items should be here. See also dsreq.h
*/
#ident "$Revision: 1.7 $"
#ifdef sgi && !defined(__STDC__)
# define __STDC__ /* not quite, but real close */
#endif
/*
* The DEVSCSI driver takes one UNIX major device number for each
* SCSI bus (host adaptor). Up to (B_MAX) busses can be supported.
* Each SCSI bus supports up to 8 (I_MAX) SCSI devices.
*
* Furthermore, DEVSCSI uses the UNIX minor device number to encode
* the device ID, LUN, and two (installation-dependent) control bits.
* The DEVSCSI driver supports 8 LUN's (L_MAX) per device, but some
* installations may not support more than one LUN.
*
* major bits minor bits
* 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* --------------- ---------------
* - - - bus - - - c c l l l i i i
*
* macros for converting dev to bus, ctrl, lun and id
* at SGI, control bits are used to indicate adapter #
* within a controller type (powerchannel supports up to 4
* scsi channels with the same interface).
*/
#define get_id(dev) (0x7 & (minor(dev)))
#define get_lun(dev) (0x7 & (minor(dev)) >> 3)
#define get_ctrl(dev) (0x7 & (minor(dev)) >> 6) /* same as bus at SGI */
#define get_bus(dev) get_ctrl(dev)
#define get_role(dev) (0) /* target role not implemented */
/* per-bus gluer interface */
typedef struct gluer {
char *glue_ident; /* identification of host/glue */
char glue_status; /* status of host/gluer */
int (*glue_init)(); /* initialize gluer */
/* (struct task_desc *, short) */
int (*glue_reserve)(); /* reserve host adapter */
/* (struct task_desc *, short) */
int (*glue_start)(); /* start host request */
/* (struct task_desc *, int) */
void (*glue_return)(); /* passback host request */
/* (struct task_desc *, int) */
int (*glue_release)(); /* release host adapter */
/* (struct task_desc *) */
int (*glue_cancel)(); /* cancel an active request */
/* (struct task_desc *) */
int (*glue_getopt)(); /* get persistant host flags */
/* (long) */
int (*glue_setopt)(); /* set persistant host flags */
/* (long) */
ulong glue_support; /* dsreq option flags supported */
ulong glue_default; /* dsreq option flags defaulted */
} gluer_t;
/* g_status definitions */
#define BUS_INIT 1 /* bus (and gluer) initialized and up */
extern struct gluer gluers[B_MAX];
#define SPLSCSI spl5 /* high enough to disable scsi interrupts */
#ifdef sgi
# define _CALLOC(ptr, x) { ptr = kern_calloc(x, 1); }
# define _CFREE(x) kern_free(x)
#else /* AUX */
# define _CALLOC(ptr, x) { ptr = kmem_alloc(x); if(ptr) bzero(ptr, x); }
# define _CFREE(x) kmem_free(x)
caddr_t kern_alloc();
#endif /* sgi */
#ifdef DEBUG
short dsdebug;
# define DBG(s) {if(dsdebug) {s;} }
#else
# define DBG(s)
#endif
/* declared here because called from both dsreq.c and dsglue.c */
#ifdef __STDC__
void dma_unlock(register struct dsiovec *, long, int);
#else __STDC__
void dma_unlock();
#endif /* __STDC__ */
/*
* Interface structures between generic portion of DEVSCSI driver
* and system-dependent glue layer.
* Each request is allocated a separate task descriptor.
*/
typedef struct task_desc {
uchar_t td_bus, td_id; /* bus number, device id 0-7 */
uchar_t td_lun, td_role; /* lun 0-7, and role 0-1 */
uchar_t td_cmdbuf[16]; /* cmd to be issued */
uchar_t td_sensebuf[100]; /* place to receive sensedata */
uchar_t td_msgbuf[6]; /* place to receive msg info */
dsiovec_t td_iovbuf[V_MAX]; /* array of data dma vectors */
dsiovec_t td_iovdummy[1]; /* buffered data dma vector */
/* td_devtype is after a pointer so will be aligned for dma */
uchar_t td_devtype; /* SCSI device type, from inquiry */
uchar_t td_cmdlen; /* len of cmd in cmdbuf */
uchar_t td_senselen; /* len of returned sense data */
uchar_t td_msglen; /* len of returned msg info */
u_short td_iovlen; /* len of io vectors present */
u_long td_datalen; /* requested/returned length */
u_long td_flags; /* filtered dsrq request flags */
u_long td_iflags; /* flags internal to driver */
uchar_t td_status; /* device status byte return */
u_short td_state; /* task state */
u_short td_ret; /* return code from glue layer */
u_short td_retry; /* retry count */
u_long td_time; /* timeout in ms */
caddr_t td_dsreq; /* ptr to devscsi data struct */
caddr_t td_hsreq; /* ptr to host scsi data struct */
struct buf td_buf; /* for use with r/w interface */
} task_desc_t;
/*
* definitions for task td_state
*/
#define TDS_START 0 /* not initialized */
#define TDS_INIT 1 /* space allocated */
#define TDS_TASK 2 /* task present */
#define TDS_RUN 3 /* task running */
#define TDS_INTERIM 4 /* host completed, need entero called */
#define TDS_WAITASYNC 5 /* async request in progress */
#define TDS_DONE 6 /* request completed */
/* definitions for task td_iflags */
#define TASK_INTERNAL 0x1 /* internal call to driver */
#define TASK_HAVETYPE 0x2 /* used for read/write interface. If set,
an inquiry has been done, so we know what form of read/write
command to use. */
#define TASK_RESET 0x4 /* reset the scsi bus; used to implement DS_RESET */
#endif /* __SYS_DSGLUE_H__ */